package com.zj.restApi;

import com.zj.web.bean.ProductDTO;
import com.zj.web.bean.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 *  定义一个Feign客户端接口，用于调用product服务
 *  访问product服务的api接口  由openFeign生成代理对象
 *  查询商品信息
 */

@FeignClient(name = "product")  //得到服务名  只能定义一个同名的服务，否则会报错
public interface ProductApi {
    //查询特价商品
    @GetMapping("/auth/product/special/{productStatus}")
    public ResponseEntity<ResponseResult> specialProducts(@PathVariable("productStatus") Integer productStatus);

    //根据状态查询所有商品
    @GetMapping("/auth/product/all/{productStatus}")
    public ResponseEntity<ResponseResult> allProducts(@PathVariable("productStatus") Integer productStatus);

    //根据ID查询商品
    @GetMapping("/auth/product/{productId}")
    public ResponseEntity<ResponseResult> getProductById(@PathVariable("productId") Long productId);

    //根据分类ID查询商品
    @GetMapping("/auth/product/category/{categoryId}")
    public ResponseEntity<ResponseResult> getProductsByCategoryId(@PathVariable("categoryId") Long categoryId);

    //根据产品id连接查询+类别表 查询全部信息
    @GetMapping("/auth/product/detail/{productId}")
    public ResponseEntity<ResponseResult> getProductDetailById(@PathVariable("productId") Long productId);

    //根据产品名字查询
    @GetMapping("/auth/product/name/{productName}")
    public ResponseEntity<ResponseResult> getProductsByName(@PathVariable("productName") String productName);

    //========================轮播图================================
    /**
     * 前台：根据状态查询轮播图，按bannerid降序
     * */
    @GetMapping("/auth/banner/getBannersByStatus/{bannerStatus}")
    public ResponseEntity<ResponseResult> getBannersByStatus(@PathVariable("bannerStatus") Integer bannerStatus);

    //========================红包福利================================
    //查询最新的活动信息
    @GetMapping("/auth/redpacket/getRedPacketActivity")
    public ResponseEntity<ResponseResult> getRedPacketActivity() ;
}
